Skip to content

Commit 9baae51

Browse files
authored
99 - Long user watch list causes page loading issues (#6514)
* 99 - Long user watch list causes page loading issues * Added pagination to view and template * Ensure ordering is also by id
1 parent c10de5d commit 9baae51

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

kitsune/users/jinja2/users/edit_watches.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ <h1 class="sumo-page-heading">{{ title }}</h1>
3030
<button class="sumo-button primary-button button-lg" type="submit">{{ _('Update') }}</button>
3131
</div>
3232
</form>
33+
{{ watch_list|paginator }}
3334
{% else %}
3435
<p>{{ _('You are not currently watching anything.') }}</p>
3536
{% endif %}

kitsune/users/views.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ def edit_contribution_area(request):
290290
@require_http_methods(["GET", "POST"])
291291
def edit_watch_list(request):
292292
"""Edit watch list"""
293-
watches = Watch.objects.filter(user=request.user).order_by("content_type")
293+
watches = Watch.objects.filter(user=request.user).order_by("content_type", "id")
294294

295295
watch_list = []
296296
for item in watches:
@@ -302,6 +302,8 @@ def edit_watch_list(request):
302302
else:
303303
watch_list.append(item)
304304

305+
watch_list = paginate(request, watch_list)
306+
305307
if request.method == "POST":
306308
for item in watch_list:
307309
item.is_active = "watch_%s" % item.id in request.POST

0 commit comments

Comments
 (0)